﻿using System;
using System.Collections.Generic;
using Autofac;
using Hyt.Core;
using Hyt.Core.Authentication;
using Hyt.Core.Cache.Providers;
using Hyt.Core.Security;
using Hyt.Passport.Persist;

namespace Hyt.Test.Ioc
{
    public class Impl_Hyt_Core:Hyt.Core.IocSetting
    {
        /// <summary>
        /// 获取规则
        /// </summary>
        /// <returns></returns>
        public override List<IAuthRule> GetAuthRules()
        {
            return new List<IAuthRule>() {};
        }

        /// <summary>
        /// 获取缓存提供类
        /// </summary>
        /// <returns></returns>
        public override Type GetCacheProviderType()
        {
            return typeof(StaticProvider);
        }

        /// <summary>
        /// 获取安全主体解析器
        /// </summary>
        /// <param name="builder"></param>
        /// <param name="unitOfWork"></param>
        /// <returns></returns>
        public override List<ICustomPrincipalResolver> GetCustomPrincipalResolvers(ContainerBuilder builder, IUnitOfWork unitOfWork)
        {
            return new List<ICustomPrincipalResolver>() { unitOfWork.Get<PassportPrincipalResolver>() };
        }
    }
}
